package com.ruoyi.production.service.impl.fertilizer;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.production.mapper.fertilizer.FertilizerNameMapper;
import com.ruoyi.production.domain.fertilizer.FertilizerName;
import com.ruoyi.production.service.fertilizer.IFertilizerNameService;

/**
 * 化肥名称Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-12
 */
@Service
public class FertilizerNameServiceImpl implements IFertilizerNameService
{
    @Autowired
    private FertilizerNameMapper fertilizerNameMapper;

    /**
     * 查询化肥名称
     *
     * @param fertilizerNameId 化肥名称ID
     * @return 化肥名称
     */
    @Override
    public FertilizerName selectFertilizerNameById(Long fertilizerNameId)
    {
        return fertilizerNameMapper.selectFertilizerNameById(fertilizerNameId);
    }

    /**
     * 查询化肥名称列表
     *
     * @param fertilizerName 化肥名称
     * @return 化肥名称
     */
    @Override
    public List<FertilizerName> selectFertilizerNameList(FertilizerName fertilizerName)
    {
        return fertilizerNameMapper.selectFertilizerNameList(fertilizerName);
    }

    /**
     * 新增化肥名称
     *
     * @param fertilizerName 化肥名称
     * @return 结果
     */
    @Override
    public int insertFertilizerName(FertilizerName fertilizerName)
    {
        fertilizerName.setCreateTime(DateUtils.getNowDate());
        return fertilizerNameMapper.insertFertilizerName(fertilizerName);
    }

    /**
     * 修改化肥名称
     *
     * @param fertilizerName 化肥名称
     * @return 结果
     */
    @Override
    public int updateFertilizerName(FertilizerName fertilizerName)
    {
        fertilizerName.setUpdateTime(DateUtils.getNowDate());
        return fertilizerNameMapper.updateFertilizerName(fertilizerName);
    }

    /**
     * 批量删除化肥名称
     *
     * @param fertilizerNameIds 需要删除的化肥名称ID
     * @return 结果
     */
    @Override
    public int deleteFertilizerNameByIds(Long[] fertilizerNameIds)
    {
        return fertilizerNameMapper.deleteFertilizerNameByIds(fertilizerNameIds);
    }

    /**
     * 删除化肥名称信息
     *
     * @param fertilizerNameId 化肥名称ID
     * @return 结果
     */
    @Override
    public int deleteFertilizerNameById(Long fertilizerNameId)
    {
        return fertilizerNameMapper.deleteFertilizerNameById(fertilizerNameId);
    }
}
